//
//  LXHttpRequestManager.h
//  bgms_p
//
//  Created by xiao.zhao@lachesis-mh.com on 16/2/19.
//  Copyright © 2016年 xiao.zhao@lachesis-mh.com. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "Reachability.h"
#import <AFNetworking/AFNetworking.h>

@interface LXHttpRequestManager : AFHTTPSessionManager

@property (nonatomic, copy) NSString *st1;
@property (nonatomic, copy) NSString *nd2;
@property (nonatomic, copy) NSString *rd3;
@property (nonatomic, copy) NSString *th4;
@property (nonatomic, copy) NSString *port;

+ (LXHttpRequestManager *)manager;

- (NetworkStatus)checkNetworkState;

- (void)GET:(NSString *)URLString
 parameters:(id)parameters
      token:token
    success:(void (^)(id response, NSString *msg))success
    failure:(void (^)(NSString *msg))failure;

- (void)POST:(NSString *)URLString
  parameters:(id)parameters
       token:token
     success:(void (^)(id response, NSString *msg))success
     failure:(void (^)(NSString *msg))failure;

- (void)PUT:(NSString *)URLString
 parameters:(id)parameters
      token:token
    success:(void (^)(id response, NSString *msg))success
    failure:(void (^)(NSString *msg))failure;

- (void)DELETE:(NSString *)URLString
    parameters:(id)parameters
         token:token
       success:(void (^)(id response, NSString *msg))success
       failure:(void (^)(NSString *msg))failure;

- (void)uploadTaskWithUrl:(NSString *)urlString
               parameters:(id)parameters
                    token:token
                  success:(void (^)(id response, NSString *msg))success
                  failure:(void (^)(NSString *msg))failure;

- (void)downloadTaskWithRequest:(NSURLRequest *)request
                       progress:(NSProgress * __autoreleasing *)progress
                    destination:(NSURL * (^)(NSURL *targetPath, NSURLResponse *response))destination
              completionHandler:(void (^)(NSURLResponse *response, NSURL *filePath, NSError *error))completionHandler;

//Post 同步请求
-(void)sendSyncPostRequest:(NSString *)requestUrl
                parameters:(NSDictionary *)params
                   success:(void (^)(id response, NSString *msg))success
                   failure:(void (^)(NSString *msg))failure;

- (void)cancelAll;

- (void)resetManagerBaseURLWithSt1:(NSString *)st1 nd2:(NSString *)nd2 rd3:(NSString *)rd3 th4:(NSString *)th4 port:(NSString *)port;
- (void)resetServiceAddress:(NSString *)URLString;

@end
